-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: make plots with red/blue stripes advected with flow #68
Conversation
…tripes. Illustrated in Euler_equations.ipynb where density is colored red to left and blue to right of contact discontinuity.
Also add snapshot_widget option to Traffic_flow.ipynb
…amples. Added new function to utils/riemann_tools.py to make simple demo plots and improved setting of x_traj points so stripes are equal width near origin
I added an We might want to improve this to allow JSAnimation as an option instead of the widgets so that people viewing the introduction online can see the time evolution. |
Looks good! Moving the stripe plotting code to I wrote a JSAnimation version of the stripe plotting in Shallow_tracer.ipynb. It avoids rasterization of the figures and looks just as nice as the widget version. However, it uses a different approach; it replaces the contents of the plot objects rather than creating a new plot each time. I think this is a preferable approach in general, but it takes a bit more work and it's different from most of our code for the book. The problem here is that the inline matplotlib backend and the JSAnimation code expect different things. For the links in the introduction, it might be nice to refer to chapters rather then filenames; e.g.
rather than
|
One other issue: personally, I think it would be better if these widgets started with t=0. But for the print book we'll want to use a non-zero time. |
This is rather clumsy but I managed to make a version of It is illustrated in |
Just tried the interacts with JSAnimation; they work quite well for me. Nothing clumsy. |
What's clumsy is that the function So this For now at least I think it's ok to just have the jsanimate version in the Introduction, and then we can discuss later whether to try to make it work more generally. |
* master: (23 commits) Updated nbstripout to remove metadata Merged pull request Editorial changes to Tammann notebook. Added characterisitics Added section in negative pressure Minor changes to examples Put repeated code into a function. Update Docker.md Update Docker.md Minor update to TammannNB Fix a couple more typos. Fix a typo. Don't show delta shocks when t=0. Add exercise regarding low Froude number limit. Add references and notes on large Froude number limit in pressureless flow chapter. Forgot to nbstrip on previous commit Added examples to Euler Tammann NB Updated Tammann book revert dirty notebooks commited by accident Add clawpack to Dockerfile and instructions for pulling from riemann@master ...
@ketch: do you understand why Travis is failing? |
I suggest closing this in favor of #71. |
In the past I've made animations of shallow water with advected colors only by running Clawpack.
Now I'm working on a tool to do this from the exact Riemann solution. I separated out the code to compute trajectories from the previous code to plot trajectories in the x-t plane in
utils/riemann_tools.py
, and use it to compute the motion of the edges of the stripes.So far this is only illustrated in
Euler_equations.ipynb
, where density is colored red to left and blue to right of contact discontinuity.I plan to use this in the Prologue notebook for the examples of shallow water equations.
I also plan to extract more of the messy code now in
Euler_equations.ipynb
and put it inriemann_tools
, but welcome comments or suggestions before doing more.